package com.whcoding.multithreading.thred;

/**
 * @program: spring-boot-learning
 * @description: 多线程顺序
 * @author: whcoding
 * @create: 2022-06-10 17:56
 **/
public class ThreadSort {

	
	public static void main(String[] args) {
		Thread t1 = new Thread(() -> {
			for (int i = 0; i < 3; i++) {
				System.out.println("t1=====>" + i);
			}
		});

		Thread t2 = new Thread(() -> {
			try {
				t1.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			for (int i = 0; i < 3; i++) {
				System.out.println("t2=====>" + i);
			}
		});

		Thread t3 = new Thread(() -> {
			try {
				t2.join();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			for (int i = 0; i < 3; i++) {
				System.out.println("t3=====>" + i);
			}
		});
		t1.start();
		t2.start();
		t3.start();
	}
}
